package api

import (
	"github.com/gin-gonic/gin"
	"zg3/live/api/handler"
	"zg3/live/pkg"
)

func LoadRouter(r *gin.Engine) {

	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/register", handler.UserRegister)
			user.POST("/login", handler.UserLogin)
		}
		live := api.Group("/live")
		{
			live.POST("/add", handler.AddLive)
			live.POST("/info", handler.InfoLive)
			live.POST("/update", handler.UpdateLive)
			live.POST("/remove", handler.RemoveLive)
		}
		comment := api.Group("/comment")
		{
			comment.Use(pkg.JWTAuth("2210a"))
			comment.POST("/add", handler.AddUserComment)
			comment.POST("/query", handler.QueryUserComment)
			comment.POST("/update", handler.UpdateUserComment)
			comment.POST("/remove", handler.RemoveUserComment)
		}
		gift := api.Group("/gift")
		{
			gift.Use(pkg.JWTAuth("2210a"))
			gift.POST("/send", handler.SendGift)
			gift.POST("/query", handler.QueryGift)
			gift.POST("/update", handler.UpdateGift)
			gift.POST("/remove", handler.RemoveGift)
		}
	}
}
